package a.f.n;

import a.a.kb;
import a.c.a;
import a.c.ab;
import a.c.d;
import a.c.m;
import a.c.w;
import a.c.x;
import a.f.c.c;
import a.f.*;
import a.f.o;

import java.util.Comparator;

import a.f.n.cb;

public class e
  extends mb
{
  public static final Object w = "y.layout.tree.HVTreeLayouter.SUBTREE_ORIENTATION";
  public static final Object x = "y.layout.tree.HVTreeLayouter.HORIZONTAL_SUBTREE";
  public static final Object y = "y.layout.tree.HVTreeLayouter.VERTICAL_SUBTREE";
  private x z;
  private cb A;
  protected o B;
  private double C = 10.0D;
  private double D = 10.0D;
  private Comparator E;
  public static int F;
  
  public e()
  {
    vc localvc = g();
    if ((k.n) || ((localvc instanceof c))) {
      ((c)localvc).a(false);
    }
  }
  
  public void a(double paramDouble)
  {
    this.C = paramDouble;
  }
  
  public double a()
  {
    return this.C;
  }
  
  public void b(double paramDouble)
  {
    this.D = paramDouble;
  }
  
  public double s()
  {
    return this.D;
  }
  
  public void a(o paramo)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    if (!bool2)
    {
      if (!kb.e(paramo)) {
        throw new a("Graph is not a tree");
      }
      wc.a(paramo);
      this.B = paramo;
    }
    ab localab = kb.i(paramo);
    this.A = new cb(paramo);
    a.c.e locale = this.A.a();
    this.z = paramo.B();
    d(locale);
    c(locale);
    paramo.a(this.z);
    do
    {
      while (!bool1)
      {
        if (localab.isEmpty()) {
          break;
        }
        wc.a(paramo.b(localab.o()));
      }
    } while (bool2);
  }
  
  public boolean b(o paramo)
  {
    return kb.e(paramo);
  }
  
  protected boolean a(a.c.e parame)
  {
    a.c.k localk = this.B.c(w);
    if (!k.n) {
      if (localk == null) {
        return false;
      }
    }
    return localk.get(parame) == y;
  }
  
  protected boolean b(a.c.e parame)
  {
    a.c.k localk = this.B.c(w);
    if (!k.n) {
      if (localk == null) {
        return true;
      }
    }
    return localk.get(parame) == x;
  }
  
  void c(a.c.e parame)
  {
    boolean bool = k.n;
    if (!bool) {
      if (a(parame)) {
        h(parame);
      }
    }
    if ((bool) || ((k.m) && ((bool) || (b(parame))))) {
      i(parame);
    }
  }
  
  void d(a.c.e parame)
  {
    boolean bool = k.n;
    if (!bool) {
      if (a(parame)) {
        f(parame);
      }
    }
    if ((bool) || ((k.m) && ((bool) || (b(parame))))) {
      e(parame);
    }
  }
  
  void e(a.c.e parame)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    a_ locala_1 = new a_();
    locala_1.a = this.B.s(parame);
    locala_1.c = this.B.t(parame);
    this.z.a(parame, locala_1);
    if (!this.A.e(parame))
    {
      double d1 = 0.0D;
      double d2 = 0.0D;
      w localw = g(parame);
      do
      {
        if (!localw.e()) {
          break;
        }
        a.c.e locale = localw.d();
        d(locale);
        if (bool2) {
          break label185;
        }
        a_ locala_2 = (a_)this.z.get(locale);
        d1 = Math.max(d1, locala_2.c);
        d2 += locala_2.a + this.C;
        localw.f();
        if (bool1) {
          break label184;
        }
      } while (!bool1);
      if (!bool2) {
        locala_1.c = (locala_1.c + this.D + d1);
      }
      label184:
      label185:
      locala_1.a += d2;
    }
  }
  
  void f(a.c.e parame)
  {
    boolean bool2 = k.n;
    boolean bool1 = k.m;
    a_ locala_1 = new a_();
    locala_1.a = this.B.s(parame);
    locala_1.c = this.B.t(parame);
    this.z.a(parame, locala_1);
    if (!this.A.e(parame))
    {
      double d1 = 0.0D;
      double d2 = 0.0D;
      w localw = g(parame);
      do
      {
        if (!localw.e()) {
          break;
        }
        a.c.e locale = localw.d();
        d(locale);
        if (bool2) {
          break label185;
        }
        a_ locala_2 = (a_)this.z.get(locale);
        d1 = Math.max(d1, locala_2.a);
        d2 += locala_2.c + this.D;
        localw.f();
        if (bool1) {
          break label184;
        }
      } while (!bool1);
      if (!bool2) {
        locala_1.a = (locala_1.a + this.C + d1);
      }
      label184:
      label185:
      locala_1.c += d2;
    }
  }
  
  protected w g(a.c.e parame)
  {
    if (this.E != null) {
      parame.b(this.E);
    }
    return parame.q();
  }
  
  public Comparator t()
  {
    return this.E;
  }
  
  public void a(Comparator paramComparator)
  {
    this.E = paramComparator;
  }
  
  void h(a.c.e parame)
  {
    boolean bool = k.m;
    a_ locala_1 = (a_)this.z.get(parame);
    double d1 = this.B.q(parame) + this.B.t(parame) + this.D;
    double d2 = this.B.p(parame) + this.B.s(parame) + this.C;
    m localm = parame.n();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      a.c.e locale = locald.f();
      a_ locala_2 = (a_)this.z.get(locale);
      this.B.c(locale, d2, d1);
      d1 += locala_2.c + this.D;
      c(locale);
      zb localzb = this.B.b(locald);
      localzb.b();
      localzb.a(this.B.m(parame), this.B.n(locale));
      localm.f();
    } while (!bool);
  }
  
  void i(a.c.e parame)
  {
    boolean bool = k.m;
    a_ locala_1 = (a_)this.z.get(parame);
    double d1 = this.B.q(parame) + this.B.t(parame) + this.D;
    double d2 = this.B.p(parame) + this.B.s(parame) + this.C;
    m localm = parame.n();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      a.c.e locale = locald.f();
      a_ locala_2 = (a_)this.z.get(locale);
      this.B.c(locale, d2, d1);
      d2 += locala_2.a + this.C;
      c(locale);
      zb localzb = this.B.b(locald);
      localzb.b();
      localzb.a(this.B.m(locale), this.B.n(parame));
      localm.f();
    } while (!bool);
  }
  
  static class a_
  {
    double a;
    double c;
    double d;
    double e;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.n.e

 * JD-Core Version:    0.7.0.1

 */